package com.pfzhang.reflection;

import java.lang.reflect.Array;

public class CatTest {

	public static void main(String[] args) {
		Cat[] cats = (Cat[]) Array.newInstance(Cat.class, 10);
		System.out.println(cats.length);
		System.out.println(cats.getClass().getComponentType().getName());
		int[] nums = (int[])Array.newInstance(int.class, 3);
		for (int i : nums) {
			System.out.println(i);
		}
		
		Array.setInt(nums, 0, 100);
		Array.setInt(nums, 1, 1000);
		Array.setInt(nums, 2, 10000);
//		Array.setInt(nums, 3, 100000);
//		Array.setInt(nums, 4, 1000000);
//		Array.setInt(nums, 5, 10000000);
		
		for (int i = 0; i < nums.length; i++) {
			System.out.println(Array.getInt(nums, i));
		}
		
	}

}
